package model.tokens;

import java.util.Deque;
import java.util.Queue;

import model.parser.ParserException;
import model.semantics.Node;
import model.semantics.LabelNode;

public class LabelToken<T> extends LiteralToken<T> {

    public LabelToken(TokenConstructorArguments<T> args) {
        super(args);

        // Only construct after a to token.
        if (!(args.lastToken instanceof ToToken)) {
            throw ParserException.BAD_TOKEN;
        }
    }

    @Override
    public Node<T> makeNewInstance(Deque<Node<T>> nodes) {
        return new LabelNode<T>(getLabel());
    }

}
